<?php
class Application_Model_DbTable_Submission extends Zend_Db_Table_Abstract{
	protected $_name = 'soumission';
	protected $_primary = array('id_personne','id_qcm','num_quest');

	public function getSubmission($qcm,$numquest,$id_pers){
		$select = $this->select();

		$select	->from(array('s'=>$this->_name))
				->where('s.id_qcm = ?',$qcm)
				->where('s.id_personne = ?',$id_pers)
				->where('s.num_quest = ?',$numquest);
				
		return $select->query()->fetch(PDO::FETCH_OBJ);
	}
	public function getPersonalSubmission($id_pers){
		$select = $this->select();
		
		$select	->distinct(true)
				->from(array('s'=>$this->_name),'id_qcm')
				->where('s.id_personne = ?',$id_pers);
		
		return $select->query()->fetchAll(PDO::FETCH_OBJ);
	}
}